{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/webuploader.css">
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/style.css">
<link href="/static/admin/css/layui.css" rel="stylesheet">
<style>
.file-item{float: left; position: relative; width: 110px;height: 110px; margin: 0 20px 20px 0; padding: 4px;}
.file-item .info{overflow: hidden;}
.uploader-list{width: 100%; overflow: hidden;}
</style>
<body class="gray-bg">
<div class="{if $ismobile==0}wrapper wrapper-content{/if} animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>申请提现</h5>
                    <!--<div class="ibox-tools">-->
                    <!--    <a class="collapse-link">-->
                    <!--        <i class="fa fa-chevron-up"></i>-->
                    <!--    </a>-->
                    <!--    <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">-->
                    <!--        <i class="fa fa-wrench"></i>-->
                    <!--    </a>-->
                    <!--    <a class="close-link">-->
                    <!--        <i class="fa fa-times"></i>-->
                    <!--    </a>-->
                    <!--</div>-->
                </div>
                <div class="ibox-content">
                    <form class="form-horizontal m-t" name="add" id="add" method="post" action="sqtixian">
						<div class="form-group">
                            <label class="col-sm-3 control-label">最低金额：{:config('txzdje')}元</label>
                            <div class="input-group col-sm-4">
                                 <label class="control-label"> </label>
                            </div>
                        </div>
						<div class="form-group">
                            <label class="col-sm-3 control-label">每日总金额：{:config('mrtxzgje')}元</label>
                            <div class="input-group col-sm-4">
                               <label class="control-label"> </label>
                            </div>
                        </div>
						
						<div class="form-group">
                            <label class="col-sm-3 control-label">今日提款总金额：{$money1}元</label>
                            <div class="input-group col-sm-4">
                                 <label class="control-label"> </label>
                            </div>
                        </div>
						
						<div class="form-group">
                            <label class="col-sm-3 control-label">单笔最高金额：{:config('aqtxje')}元</label>
                            <div class="input-group col-sm-4">
                                 <label class="control-label"> </label>
                            </div>
                        </div>
						
						<div class="form-group">
                            <label class="col-sm-3 control-label">可用余额：{$member.money}元</label>
                            <div class="input-group col-sm-4">
                                 <label class="control-label"> </label>
                            </div>
                        </div>
						
                        <div class="form-group">
                            <label class="col-sm-3 control-label">提现金额：</label>
                            <div class="input-group col-sm-4">
                                <input id="money" type="text" class="form-control" name="money" placeholder="输入提现金额">
                            </div>
                        </div>
						
						
						
						
						
						<div class="form-group">
                            <label class="col-sm-3 control-label">登录密码：</label>
                            <div class="input-group col-sm-4">
                                <input id="password" type="password" class="form-control" name="password" placeholder="登录密码">
                            </div>
                        </div>
                        
                        <div class="form-group">
                            <label class="col-sm-3 control-label">提现密码：</label>
                            <div class="input-group col-sm-4">
                                <input id="txpassword" type="password" class="form-control" name="txpassword" placeholder="提现密码">
                                <span style="color:red">请输入提现密码,第一次输入后,自动保存,后期请使用当前输入的提现密码进行提现.</span>
                            </div>
                        </div>
						
						<div class="form-group" style="display:none">
                            <label class="col-sm-3 control-label">收款模式：</label>
                            <div class="input-group col-sm-4">
                                <select class="form-control m-b chosen-select" name="type" id="type">
                                  
											{if config('dlskms')==0||config('dlskms')==2}
                                            <option value="1" {if $type==1}selected{/if}>收款码</option>
											{/if}
											{if config('dlskms')==0||config('dlskms')==1}
                                            <option value="0" {if $type==0}selected{/if}>账户</option>
											{/if}
                                </select>
                            </div>
                        </div>
						{if config('dlskms')==0||config('dlskms')==2}
						<div id="skm" {if config('dlskms')==0&&$type==0}style="display:none"{/if}>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-3 control-label">收款码：</label>
								<div class="input-group col-sm-4">
									<input id="imgurl" type="hidden" class="form-control" name="imgurl" placeholder="上传收款码" value="{if !empty($zhsk)}{$zhsk['imgurl']}{/if}">
									
									 <div id="fileList" class="uploader-list" style="float:right"></div>
									 <div id="" style="float:left">请将收款码提供客服,备注提现单号或者提现ID</div>
									<!--<div id="imgPicker" style="float:left">选择文件</div>-->
									<!--<div style="clear:both"><img id="imgurl2" src="{if !empty($zhsk)}{$zhsk['imgurl']}{/if}" style="max-width:200px"></div>-->
								</div>
							</div>
                        </div>
						{/if}
						{if config('dlskms')==0||config('dlskms')==1}
						<div id="zhanghu" {if config('dlskms')==0&&$type!=0}style="display:none"{/if}>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-3 control-label">收款人：</label>
								<div class="input-group col-sm-4">
									<input id="name" type="text" class="form-control" name="name" placeholder="请填写收款人" value="{if !empty($zhsk2)}{$zhsk2['name']}{/if}">
									
									
								</div>
							</div>
							
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-3 control-label">收款账号：</label>
								<div class="input-group col-sm-4">
									<input id="zhanghao" type="text" class="form-control" name="zhanghao" placeholder="请填写收款账号" value="{if !empty($zhsk2)}{$zhsk2['zhanghao']}{/if}">
									
									
								</div>
							</div>
							
							
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-3 control-label">账号类型：</label>
								<div class="input-group col-sm-4">
									<input id="leixing" type="text" class="form-control" name="leixing" placeholder="请填写账号类型" value="{if !empty($zhsk2)}{$zhsk2['leixing']}{/if}">
									
									
								</div>
							</div>
                        </div>
                      {/if}
                       
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 确定</button>&nbsp;&nbsp;&nbsp;
                                
                            </div>
                        </div>
                    </form>
                </div>
            </div>

        </div>
    </div>
</div>
  {include file="public/footer" /}

<!--<script type="text/javascript" src="/static/admin/webupload/webuploader.min.js"></script>-->

<script type="text/javascript">

	{if config('dlskms')==0}


    {if $type==1||$type==2}
                    var $list = $('#fileList');
    
    //上传图片,初始化WebUploader
    // var uploader = WebUploader.create({
     
    //     auto: true,// 选完文件后，是否自动上传。   
    //     swf: '/static/admin/webupload/Uploader.swf',// swf文件路径 
    //     server: "{:url('Upload/upload')}",// 文件接收服务端。
    //     duplicate :true,// 重复上传图片，true为可重复false为不可重复
    //     pick: '#imgPicker',// 选择文件的按钮。可选。

    //     accept: {
    //       title: 'Images',
    //         extensions: 'gif,jpg,jpeg,bmp,png',
    //         mimeTypes: 'image/jpg,image/jpeg,image/png'
    //     },

    //     'onUploadSuccess': function(file, data, response) {
        
    //         if(data.code==0){
    //             layer.msg('没有上传权限', {icon: 5,time:1500,shade: 0.1}, function(index){
    //                 layer.close(index);
    //             });
    //         }else{
    //         $("#imgurl").val("/uploads/images/"+data._raw);
            
    //         $("#imgurl2").attr("src","/uploads/images/"+data._raw);
            
    //         }
    //     }
    // });

    // uploader.on( 'fileQueued', function( file ) {
    //     $list.html( '<div id="' + file.id + '" class="item">' +
    //         '<h4 class="info">' + file.name + '</h4>' +
    //         '<p class="state">正在上传...</p>' +
    //     '</div>' );
    // });

    // // 文件上传成功
    // uploader.on( 'uploadSuccess', function( file ) {
    //     $( '#'+file.id ).find('p.state').text('上传成功！');
    // });

    // // 文件上传失败，显示上传出错。
    // uploader.on( 'uploadError', function( file ) {
    //     $( '#'+file.id ).find('p.state').text('上传出错!');
    // }); 

        $("#type").change(function(){
            var type=$(this).val();
            if(type==0){
                $("#skm").hide();
                $("#zhanghu").show();
            }else{
                $("#zhanghu").hide();
                $("#skm").show();
               



    
       
    
            }
            
        })
    {else}
		var shouci=0;
		$("#type").change(function(){
			var type=$(this).val();
			if(type==0){
				$("#skm").hide();
				$("#zhanghu").show();
			}else{
				$("#zhanghu").hide();
				$("#skm").show();
				if(shouci==0){
				var $list = $('#fileList');
	
    //上传图片,初始化WebUploader
//     var uploader = WebUploader.create({
     
//         auto: true,// 选完文件后，是否自动上传。   
//         swf: '/static/admin/webupload/Uploader.swf',// swf文件路径 
//         server: "{:url('Upload/upload')}",// 文件接收服务端。
//         duplicate :true,// 重复上传图片，true为可重复false为不可重复
//         pick: '#imgPicker',// 选择文件的按钮。可选。

//         accept: {
//           title: 'Images',
//             extensions: 'gif,jpg,jpeg,bmp,png',
//             mimeTypes: 'image/jpg,image/jpeg,image/png'
//         },

//         'onUploadSuccess': function(file, data, response) {
		
// 			if(data.code==0){
// 				layer.msg('没有上传权限', {icon: 5,time:1500,shade: 0.1}, function(index){
//                     layer.close(index);
//                 });
// 			}else{
// 			$("#imgurl").val("/uploads/images/"+data._raw);
			
// 			$("#imgurl2").attr("src","/uploads/images/"+data._raw);
			
// 			}
//         }
//     });

    // uploader.on( 'fileQueued', function( file ) {
    //     $list.html( '<div id="' + file.id + '" class="item">' +
    //         '<h4 class="info">' + file.name + '</h4>' +
    //         '<p class="state">正在上传...</p>' +
    //     '</div>' );
    // });

    // 文件上传成功
    // uploader.on( 'uploadSuccess', function( file ) {
    //     $( '#'+file.id ).find('p.state').text('上传成功！');
    // });

    // // 文件上传失败，显示上传出错。
    // uploader.on( 'uploadError', function( file ) {
    //     $( '#'+file.id ).find('p.state').text('上传出错!');
    // }); 
		shouci=1;
		}
	
			}
			
		})
	 {/if}
	{/if}


	{if config('dlskms')==2}
    var $list = $('#fileList');
	
    //上传图片,初始化WebUploader
//     var uploader = WebUploader.create({
     
//         auto: true,// 选完文件后，是否自动上传。   
//         swf: '/static/admin/webupload/Uploader.swf',// swf文件路径 
//         server: "{:url('Upload/upload')}",// 文件接收服务端。
//         duplicate :true,// 重复上传图片，true为可重复false为不可重复
//         pick: '#imgPicker',// 选择文件的按钮。可选。

//         accept: {
//           title: 'Images',
//             extensions: 'gif,jpg,jpeg,bmp,png',
//             mimeTypes: 'image/jpg,image/jpeg,image/png'
//         },

//         'onUploadSuccess': function(file, data, response) {
		
// 			if(data.code==0){
// 				layer.msg('没有上传权限', {icon: 5,time:1500,shade: 0.1}, function(index){
//                     layer.close(index);
//                 });
// 			}else{
// 			$("#imgurl").val("/uploads/images/"+data._raw);
			
// 			$("#imgurl2").attr("src","/uploads/images/"+data._raw);
			
// 			}
//         }
//     });

    // uploader.on( 'fileQueued', function( file ) {
    //     $list.html( '<div id="' + file.id + '" class="item">' +
    //         '<h4 class="info">' + file.name + '</h4>' +
    //         '<p class="state">正在上传...</p>' +
    //     '</div>' );
    // });

    // // 文件上传成功
    // uploader.on( 'uploadSuccess', function( file ) {
    //     $( '#'+file.id ).find('p.state').text('上传成功！');
    // });

    // // 文件上传失败，显示上传出错。
    // uploader.on( 'uploadError', function( file ) {
    //     $( '#'+file.id ).find('p.state').text('上传出错!');
    // }); 
	{/if}
</script>
   
<script type="text/javascript">

    $(function(){
        
        
        
      
        
        
        $('#add').ajaxForm({
            beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
            success: complete, // 这是提交后的方法
            dataType: 'json'
        });
        
        
        

        function checkForm(){
            
            
            
            
            if( '' == $.trim($('#money').val())){
                layer.msg('提现金额不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }
			if( '' == $.trim($('#password').val())){
                layer.msg('登录密码不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }
            
             if( '' == $.trim($('#txpassword').val())){
                layer.msg('提现密码不能为空', {icon: 5,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }
            
           
			
// 			if(1 == $.trim($('#type').val())){
// 				if( '' == $.trim($('#imgurl').val())){
// 					layer.msg('请上传收款码', {icon: 5,time:1500,shade: 0.1}, function(index){
// 						layer.close(index);
// 					});
// 					return false;
// 				}
			
			
// 			}
			
			if(0 == $.trim($('#type').val())){
				if( '' == $.trim($('#name').val())){
					layer.msg('请填写收款人', {icon: 5,time:1500,shade: 0.1}, function(index){
						layer.close(index);
					});
					return false;
				}
				
				if( '' == $.trim($('#zhanghao').val())){
					layer.msg('请填写收款账号', {icon: 5,time:1500,shade: 0.1}, function(index){
						layer.close(index);
					});
					return false;
				}
				
				if( '' == $.trim($('#leixing').val())){
					layer.msg('请填写账号类型', {icon: 5,time:1500,shade: 0.1}, function(index){
						layer.close(index);
					});
					return false;
				}
			
			
			}
			$("button").removeClass('btn-primary').addClass('btn-danger').text("提交中...");
			

     }

        function complete(data){
            if(data.code == 1){
                layer.msg(data.msg, {icon: 6,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                    window.location.href="{:url('jilu')}";
                });
            }else{
                layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1}, function(index){
                    layer.close(index);
                });
                return false;
            }
        }

    });


    //IOS开关样式配置
   var elem = document.querySelector('.js-switch');
        var switchery = new Switchery(elem, {
            color: '#1AB394'
        });
    var config = {
        '.chosen-select': {},                    
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }



</script>
</body>
</html>
